<template>
	<view class="warp">
		<top-nav title="私钥字符"></top-nav>
		<view class="content">
			<u-input v-model="value" :customStyle="{
				borderColor:'#69DA73'
			}" :height="height" :type="type" :border="false" />
		</view>
		<view class="desc">1、妥善保管私钥至隔离网络的安全地方 <br>2、请勿将助记词在联网环境下分享和存储，比如邮件、相册、社交应用等。</view>
		<view class="bottom">
			<my-button @clickFun="clickFun">复制</my-button>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import topNav from 'components/top-nav/top-vue.vue';
	import button from 'pages/login/components/button.vue'
	import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
	export default{
		data(){
			return {
				value:'',
				type: 'textarea',
				border: true,
				height: 500,
				autoHeight: true,
			}
		},
		mounted() {
			this.$u.post('/api/privateKey', {checkMasterKey:uni.getStorageSync('master_key').join(',')}).then(res=>{
				if(res.code==200){
					this.value = res.data.privateKey
				} else {
					this.requireShow=true;
					this.requireContent=res.message;
				}
			})
		},
		components:{
			'topNav':topNav,
			'myButton': button
		},
		methods:{
			updateFun(){
				this.$refs.uToast.show({
					title: '更新成功',
					type: 'success',
				})
			},
			clickFun(){
				uniCopy({
					content:this.value,
					success:(res)=>{
						uni.showToast({
							title: res,
							icon: 'none'
						})
					},
					error:(e)=>{
						uni.showToast({
							title: e,
							icon: 'none',
							duration:3000,
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.warp{
		padding: 0 26*2rpx;
		.time{
			font-size:14*2rpx;
			display: flex;
			margin-top:50rpx;
			.green{
				color: #69DA73;
				margin-left:20rpx;
			}
		}
		.content{
			text-align: justify;
			margin:34*2rpx 0 100*2rpx;
			/deep/.u-input__textarea{
				padding:40rpx;
				border: 1px solid #69DA73;
				font-size:36rpx;
				background: rgba(105, 218, 115, 0.1);
				color:#fff;
			}
		}
		.desc{
			font-size:24rpx;
			margin-bottom:50*2rpx;
		}
		.bottom{
			height:100*2rpx;
			background-color: #202020;
			width: 100%;
			bottom: 0;
			position: fixed;
			left:0;
		}
	}
</style>
